package cn.itcast.servlet;

import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.itcast.utils.DBType;


public class SetDBServlet extends HttpServlet
{
private static final long serialVersionUID = -3623034377180808254L;

public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException
{
  request.setCharacterEncoding("UTF-8");
  
  try
  {
	  String dbType = request.getParameter("dbType");
	  
	  if (dbType != null) {
		  DBType.curDB = dbType;
		  System.out.println("切换到:" + DBType.curDB);
	  }
    
      response.sendRedirect(request.getContextPath() + "/listCustomer");
  }
  catch (Exception e)
  {
    e.printStackTrace();
  }
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException
{
  doGet(request, response);
}
}